package edu.gatech.volt2.drdoommgt.gui;

import java.awt.EventQueue;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;


@SuppressWarnings("serial")
public class SysAdminWindow extends JFrame implements ISysAdminView {

	private JPanel contentPane;
	JButton createUserButton;
	JButton deleteUserButton;
	JButton editUserButton;
	JButton viewUsersButton;
	JButton searchPatientButton;
	JButton treatmentButton;
	JButton apptPageButton;
	JButton reportButton;
	JButton setPasswordButton;
	JButton suspendButton;
	JButton exitButton;
	

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					SysAdminWindow frame = new SysAdminWindow();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public SysAdminWindow() {
		setResizable(false);
		setTitle("Dr. Doom Management");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 475, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JPanel panel = new JPanel();
		panel.setBounds(5, 5, 464, 267);
		contentPane.add(panel);
		panel.setLayout(null);
		
		JLabel optionLabel = new JLabel("What would you like to do?");
		optionLabel.setHorizontalAlignment(SwingConstants.CENTER);
		optionLabel.setBounds(133, 10, 177, 29);
		panel.add(optionLabel);
		
		createUserButton = new JButton("Create a User");
		createUserButton.setBounds(10, 51, 180, 30);
		panel.add(createUserButton);
		
		deleteUserButton = new JButton("Delete a User");
		deleteUserButton.setBounds(10, 92, 180, 30);
		panel.add(deleteUserButton);
		
		editUserButton = new JButton("Edit a User");
		editUserButton.setBounds(10, 133, 180, 30);
		panel.add(editUserButton);
		
		viewUsersButton = new JButton("View Users");
		viewUsersButton.setBounds(10, 174, 180, 30);
		panel.add(viewUsersButton);
		
		searchPatientButton = new JButton("Search Patient by Name");
		searchPatientButton.setBounds(10, 215, 180, 30);
		panel.add(searchPatientButton);
		
		treatmentButton = new JButton("Create a Treatment Record");
		treatmentButton.setBounds(212, 52, 180, 30);
		panel.add(treatmentButton);
		
		apptPageButton = new JButton("View Daily Appointment Page");
		apptPageButton.setBounds(212, 92, 180, 30);
		panel.add(apptPageButton);
		
		reportButton = new JButton("View Reports and Statistics");
		reportButton.setBounds(210, 133, 180, 30);
		panel.add(reportButton);
		
		setPasswordButton = new JButton("Set/Reset User Password");
		setPasswordButton.setBounds(210, 174, 180, 30);
		panel.add(setPasswordButton);
		
		suspendButton = new JButton("Suspend/Unsuspend User");
		suspendButton.setBounds(210, 215, 180, 30);
		panel.add(suspendButton);
		
		exitButton = new JButton("Logout");
		exitButton.setBounds(388, 238, 70, 23);
		panel.add(exitButton);
	}

	/**
	 * @return the createUserButton
	 */
	public JButton getCreateUserButton() {
		return createUserButton;
	}

	/**
	 * @return the deleteUserButton
	 */
	public JButton getDeleteUserButton() {
		return deleteUserButton;
	}

	/**
	 * @return the editUserButton
	 */
	public JButton getEditUserButton() {
		return editUserButton;
	}

	/**
	 * @return the viewUsersButton
	 */
	public JButton getViewUsersButton() {
		return viewUsersButton;
	}

	/**
	 * @return the searchPatientButton
	 */
	public JButton getSearchPatientButton() {
		return searchPatientButton;
	}

	/**
	 * @return the treatmentButton
	 */
	public JButton getTreatmentButton() {
		return treatmentButton;
	}

	/**
	 * @return the apptPageButton
	 */
	public JButton getApptPageButton() {
		return apptPageButton;
	}

	/**
	 * @return the reportButton
	 */
	public JButton getReportButton() {
		return reportButton;
	}

	/**
	 * @return the setPasswordButton
	 */
	public JButton getSetPasswordButton() {
		return setPasswordButton;
	}

	/**
	 * @return the suspendButton
	 */
	public JButton getSuspendButton() {
		return suspendButton;
	}

	/**
	 * @return the exitButton
	 */
	public JButton getExitButton() {
		return exitButton;
	}

	public void addListener(ActionListener al) {
		createUserButton.addActionListener(al);
		deleteUserButton.addActionListener(al);
		editUserButton.addActionListener(al);
		viewUsersButton.addActionListener(al);
		searchPatientButton.addActionListener(al);
		treatmentButton.addActionListener(al);
		apptPageButton.addActionListener(al);
		reportButton.addActionListener(al);
		setPasswordButton.addActionListener(al);
		suspendButton.addActionListener(al);
		exitButton.addActionListener(al);
		
	}

	public void showSelf(){
		this.setVisible(true);
	}
	
	public void hideSelf(){
		this.setVisible(false);
	}


}
